package com.example.common.model.kafka;

/**
 * @author FanFu
 * @version 1.0
 * @date 2025/11/8 20:47
 */
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class OrderMessage {
    private String eventType; // CREATE, UPDATE, CANCEL
    private Long orderId;
    private String orderNo;
    private Long userId;
    private BigDecimal amount;
    private Integer status;
    private LocalDateTime eventTime;

    public static OrderMessage createOrderMessage(Long orderId, String orderNo, Long userId, BigDecimal amount) {
        OrderMessage message = new OrderMessage();
        message.setEventType("CREATE");
        message.setOrderId(orderId);
        message.setOrderNo(orderNo);
        message.setUserId(userId);
        message.setAmount(amount);
        message.setStatus(0);
        message.setEventTime(LocalDateTime.now());
        return message;
    }
}